<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>argumennts获取设置非行间样式</title>
	</head>
	<body>
		<div id="div1" style="width:200px;background: red;height: 200px;"></div>
		<script>
        function getstyle(obj,name,value){
        	if(obj.currentStyle){
        		return obj.currentStyle()[name];
        	}else{
        		return getComputedStyle(obj,false)[name];
        	}
        	else if (arguments.length==3){
        		obj.style[name]=value;
        	}else{
        		alert("波波");
        	}
        }
			window.onload=function(){
				var div1=document.getElementById("div1");
				alert(getstyle(div1,"width"));
			getstyle(div1,"background","blue   ");
			}
			
			
		</script>
		
	</body>
</html>